package com.tianqu.tms.entity;

import java.util.List;

import com.tianqu.tms.core.exception.TmsDaoException;
import com.tianqu.tms.dao.TmsDao;
import com.tianqu.tms.dao.TmsFinanciaDaoImp;
import com.tianqu.tms.dao.TmsMarketCarFinancialDaoImp;
import com.tianqu.tms.dao.ViewListDao;
import com.tianqu.tms.dto.TmsFinanciaDto;
import com.tianqu.tms.dto.TmsFinanciaParam;
import com.tianqu.tms.dto.TmsMarketCarFinancialDto;
import com.tianqu.tms.dto.TmsMarketCarFinancialParam;

public class TmsFinancial extends ViewListManager {
	
	private static TmsFinancial INSTANCE =new TmsFinancial();
	
	private  TmsFinancial() {}
	
	public static TmsFinancial getInstance() throws TmsDaoException {
			return INSTANCE;
	}
	
	public static TmsFinancial getTmsFinancialPageInstance() throws TmsDaoException {
		return new TmsFinancial();
    }
	
	public List<TmsFinanciaDto> findTmsFinancia(TmsFinanciaParam param) throws TmsDaoException {
		TmsFinanciaDaoImp mDao = (TmsFinanciaDaoImp) TmsDao.getInstance(TmsDao.TMS_FINANCIA, getPageNo(), getMaxIndex(),getSortKey(), isAsc());
		List<TmsFinanciaDto> list = mDao.find(param);
		setPagingInfo(mDao);
		return list;
	}
	
	public TmsFinanciaDto getTmsFinancia(String id) throws TmsDaoException {
		TmsFinanciaDaoImp mDao = (TmsFinanciaDaoImp) TmsDao.getInstance(TmsDao.TMS_FINANCIA, getPageNo(), getMaxIndex(),getSortKey(), isAsc());
		return  mDao.get(id);
	}
	
	public List<TmsFinanciaDto> find(String realNamePy, String status, int limit) throws TmsDaoException{
		TmsFinanciaDaoImp mDao = (TmsFinanciaDaoImp) TmsDao.getInstance(TmsDao.TMS_FINANCIA);
		return mDao.find(realNamePy, status,limit);
	}
	
	public boolean isRepeatName(String name,int type) throws TmsDaoException{
		TmsFinanciaDaoImp mDao = (TmsFinanciaDaoImp) TmsDao.getInstance(TmsDao.TMS_FINANCIA);
		return mDao.isRepeatName(name, type);
	}
	
	public void updateTmsFinancia(TmsFinanciaDto dto) throws TmsDaoException {
		TmsFinanciaDaoImp mDao = (TmsFinanciaDaoImp) TmsDao.getInstance(TmsDao.TMS_FINANCIA);
		mDao.update(dto);
	}
	
	public void insertTmsFinancia(TmsFinanciaDto dto) throws TmsDaoException {
		TmsFinanciaDaoImp mDao = (TmsFinanciaDaoImp) TmsDao.getInstance(TmsDao.TMS_FINANCIA);
		mDao.insert(dto);
	}
	
	public TmsMarketCarFinancialDto getTmsMarketCarFinancial(String id) throws TmsDaoException {
		TmsMarketCarFinancialDaoImp mDao = (TmsMarketCarFinancialDaoImp) TmsDao.getInstance(TmsDao.TMS_MARKET_CAR_FINANCIAL, getPageNo(), getMaxIndex(),getSortKey(), isAsc());
		return mDao.get(id);
	}
	
	//
	public List<TmsMarketCarFinancialDto> findTmsMarketCarFinancial(TmsMarketCarFinancialParam param) throws TmsDaoException {
		TmsMarketCarFinancialDaoImp mDao = (TmsMarketCarFinancialDaoImp) TmsDao.getInstance(TmsDao.TMS_MARKET_CAR_FINANCIAL, getPageNo(), getMaxIndex(),getSortKey(), isAsc());
		List<TmsMarketCarFinancialDto> list = mDao.find(param);
		setPagingInfo(mDao);
		return list;
	}
	
	public void updateTmsMarketCarFinancial(TmsMarketCarFinancialDto dto) throws TmsDaoException {
		TmsMarketCarFinancialDaoImp mDao = (TmsMarketCarFinancialDaoImp) TmsDao.getInstance(TmsDao.TMS_MARKET_CAR_FINANCIAL);
		mDao.update(dto);
	}
	
	public void insertTmsMarketCarFinancial(TmsMarketCarFinancialDto dto) throws TmsDaoException {
		TmsMarketCarFinancialDaoImp mDao = (TmsMarketCarFinancialDaoImp) TmsDao.getInstance(TmsDao.TMS_MARKET_CAR_FINANCIAL);
		mDao.insert(dto);
	}
}
